function [Params, strPars,pfval,lb,ub]=parsCalibPars(outName)

global drvNm parNm dbpr
%% parsing the out file for payoffs, parameter values, parameter bounds, and parameter names; 
% This is a fairly general code with two caveates:
% first, it needs correct drive name (drvNm) as a global parameter;
% second, it needs all parameters to have lower and upper bounds

pfval=-1e6;
Params=[];
strPars={};
lb=[];
ub=[];

fid=fopen([drvNm outName]);
tline=fgetl(fid);
k=1;
while ischar(tline)
    if not(tline(1)==':')
        [~,nomatch]=regexp(tline,' [<=]+ ','match','split');  %breaks the line into required components for extracting parameter names and values
        strPars{k}= nomatch{2};
        Params(k)=str2double(nomatch{3});
        lb(k)=str2double(nomatch{1});
        ub(k)=str2double(nomatch{4});
        k=k+1;
    else
        if not(isempty(strfind(tline,':COMSYS Best payoff is ')))
            pfval=str2double(tline(24:end));
        end
    end
    tline=fgetl(fid);
end
fclose(fid);

end %of function



